<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="<{'static/css/bootstrap/bootstrap.min.css'|url}>" />
		<link rel="stylesheet" href="<{'static/css/bootstrap/bootstrap-responsive.min.css'|url}>" />
		<!--[if lt IE 6]> <link rel="stylesheet" href="<{'static/css/bootstrap/bootstrap-ie6.min.css'|url}>" /> <![endif]-->
		<{include file='html.tpl'}>
		<link rel="stylesheet" href="<{'static/css/unicorn.main.css'|url}>" />
		<link rel="stylesheet" href="<{'static/css/unicorn.grey.css'|url}>" class="skin-color" />

		<{include file="form.tpl"}>

		<script src="<{'static/js/bootstrap/bootstrap.min.js'|url}>"></script>
		<!--[if lt IE 6]> <script src="<{'static/js/bootstrap/bootstrap-ie.js'|url}>"></script> <![endif]-->
		<script language="javascript" src="<{'static/js/DatePicker/WdatePicker.js'|url}>"></script>
	</head>
	<body>
		<div id="header">
			<h1><a href="<{'admin'|url}>">Home</a></h1>	
		</div>
		<{include file="admin/nav.tpl"}>

		<{include file="admin/sidebar.tpl"}>

		<{include file="admin/style-switcher.tpl"}>
		
		<div id="content">
			<div id="content-header">
				<h1>用戶列表</h1>
				<{include file="admin/widget.tpl"}>
			</div>
			<div id="breadcrumb">
				<a href="<{'admin'|url}>" title="返回首頁" class="tip-bottom"><i class="icon-home"></i> 後臺</a>
				<a href="<{'admin/member'|url}>">用戶管理</a>
				<a href="<{'admin/member/list'|url}>" class="current">用戶列表</a>
			</div>
			<div class="container-fluid">
				<!--搜索框-->
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
						<form class="form-horizontal" method="GET" action="?" id="search_form" novalidate="novalidate" autocomplete="off">
							<div class="widget-title">
								<a href="#collapseSearch" data-toggle="collapse">
								<span class="icon">
									<i class="icon-search"></i>									
								</span>
								<h5>條件蒐索</h5>
								</a>
								<div class="buttons">
									<a class="btn btn-small" href="#collapseSearch" data-toggle="collapse"><i class="icon-chevron-up"></i> 展開</a>
									<button title="Icon Title" class="btn btn-small btn-warning" type="submit"><i class="icon-search icon-white"></i> 蒐索</button>
								</div>
							</div>
							<div class="collapse in" id="collapseSearch">
								<div class="widget-content nopadding">
									<div class="span6">
										<div class="control-group">
											<label class="control-label">稱呼</label>
											<div class="controls">
												<input type="text" name="nickname" id="nickname" value="<{$_param_data.nickname|escape}>" placeholder="請輸入關鍵字..." />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">用戶組</label>
											<div class="controls">
												<select name="gid[]" class="form-control" id="gid" multiple="multiple" style="width: 80%;" placeholder="請選擇用戶組...">
													<{foreach item=item key=k from=$_group_data}>
													<option value="<{$item.gid|escape}>" <{if is_array($_param_data.gid) && in_array($item.gid, $_param_data.gid)}>selected="selected"<{/if}> ><{$item.group_name|escape}></option>
													<{/foreach}>
												</select>
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">註冊時間</label>
											<div class="controls">
												<div class="span4"><input type="text" name="timeline[min]" placeholder="開始時間" id="timeline_min" class="Wdate" value="<{$_param_data.timeline.min|date_format:'%Y-%m-%d'|default:''}>" /></div>
												<div class="span1">~</div>
												<div class="span4"><input type="text" name="timeline[max]" placeholder="結束時間" id="timeline_max" class="Wdate" value="<{$_param_data.timeline.max|date_format:'%Y-%m-%d'|default:''}>" /></div>
												<div class="clearfix"></div>
											</div>
										</div>
									</div>
									<div class="span6">
										<div class="control-group">
											<label class="control-label">賬號</label>
											<div class="controls">
												<input type="text" name="username" id="username" value="<{$_param_data.username|escape}>" placeholder="請輸入賬號..."  />
											</div>
										</div>
										<div class="control-group">
											<label class="control-label">最後登錄</label>
											<div class="controls">
												<div class="span4"><input type="text" name="lastlogin[min]" placeholder="開始時間" id="lastlogin_min" class="Wdate" value="<{$_param_data.lastlogin.min|date_format:'%Y-%m-%d'|default:''}>" /></div>
												<div class="span1">~</div>
												<div class="span4"><input type="text" name="lastlogin[max]" placeholder="結束時間" id="lastlogin_max" class="Wdate" value="<{$_param_data.lastlogin.max|date_format:'%Y-%m-%d'|default:''}>" /></div>
												<div class="clearfix"></div>
											</div>
										</div>
									</div>
									<div class="clearfix"></div>
								</div>
							</div>
						</form>
						</div>
					</div>
				</div>
				<!--結果-->
				<div class="row-fluid">
					<div class="span12">
						<div class="pull-right btn-group">
							<a class="btn btn-small btn-success" href="<{'admin/member/add'|url}>"><i class="icon icon-plus icon-white"></i> 添加用戶</a>
							<a class="btn btn-small" href="javascript:" onclick="javascript:location.reload();"><i class="icon icon-refresh"></i> 刷新頁面</a>
						</div>
						<div class="clearfix"></div>
						<div class="widget-box">
							
							<div class="widget-title">
								<span class="icon">
									<input type="checkbox" id="checkAll" />
								</span>
								<h5>用戶列表</h5>
								<span class="label">總共：<{$_member_data.count|escape}>條</span>
								<div class="buttons">
									
									<div class="btn-group">
									  <button class="btn btn-small"><i class="icon-wrench"></i> 操作</button>
									  <button data-toggle="dropdown" class="btn btn-small dropdown-toggle"><span class="caret"></span></button>
									  <ul class="dropdown-menu">
										<!-- <li><a href="<{'admin/member/delete_query'|url}>" method="get" confirm="您確定刪除這%L個用戶？此操作不可恢復！" selector="#result_form [name='uid[]']:checked"><i class="icon-remove"></i> 刪除用戶</a></li> -->
									  </ul>
									</div>
								</div>
								<div class="clearfix"></div>
							</div>
							<div class="widget-content nopadding">
								<form action="?" id="result_form" method="get">
									<table class="table table-striped table-bordered with-check">
										<thead>
											<tr>
												<th>#</th>
												<th>ID</th>
												<th>賬號</th>
												<th>呢稱</th>
												<th>性別</th>
												<th>用戶組</th>
												<th order_by="timeline">註冊時間</th>
												<th order_by="lastlogin">最後登錄</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
										<{foreach $_member_data.data as $key => $item}>
											<tr>
												<td><input type="checkbox" name="uid[]" value="<{$item.uid|escape}>" /></td>
												<td><{$item.uid|escape}></td>
												<td><{$item.username|escape}></td>
												<td><{$item.nickname|escape}></td>
												<td><{$item.sex.text|escape}></td>
												<td><span class="badge badge-important"><{$item.gid_group_name|escape}></span></td>
												<td><{$item.timeline|date_format:'%Y-%m-%d %H:%M'}></td>
												<td><{if !empty($item.lastlogin)}><{$item.lastlogin|date_format:'%Y-%m-%d %H:%M'}><{/if}></td>
												<td class="taskOptions">
													<a href="<{'admin/member/edit'|url}>?uid=<{$item.uid|escape}>" class="tip-top" name="" data-original-title="修改"><i class="icon-pencil"></i></a>
													|
													<a href="<{'admin/member/delete_query'|url}>?uid=<{$item.uid|escape}>" class="tip-top" confirm="您確定刪除用戶：<{$item.username|escape}>？此操作不可恢復！" name="delete" method="get" data-original-title="刪除用戶"><i class="icon-trash"></i></a>
												
												</td>
											</tr>
										<{/foreach}>
										</tbody>
									</table>
								</form>
								<div class="center page-navigation"><{$_page_string}></div>
							</div>
						</div>
					</div>
				</div>
				<{include file="admin/copyright.tpl"}>
			</div>
		</div>
		
<{include file="admin/footer.tpl"}>
<script type="text/javascript">
(function($){
$().ready(function(){
	
	
	$('#timeline_min').on('focus',function(){
		WdatePicker({
			skin: 'twoer',
			isShowClear:true,
			readOnly:true,
			dateFmt:'yyyy-MM-dd',
			isShowOthers:false,
			maxDate: '#F{$dp.$D(\'timeline_max\')}'
		});
	});
	$('#timeline_max').on('focus',function(){
		WdatePicker({
			skin: 'twoer',
			isShowClear:true,
			readOnly:true,
			dateFmt:'yyyy-MM-dd',
			isShowOthers:false,
			minDate: '#F{$dp.$D(\'timeline_min\')}'
		});
	});
	$('#lastlogin_min').on('focus',function(){
		WdatePicker({
			skin: 'twoer',
			isShowClear:true,
			readOnly:true,
			dateFmt:'yyyy-MM-dd',
			isShowOthers:false,
			maxDate: '#F{$dp.$D(\'lastlogin_max\')}'
		});
	});
	$('#lastlogin_max').on('focus',function(){
		WdatePicker({
			skin: 'twoer',
			isShowClear:true,
			readOnly:true,
			dateFmt:'yyyy-MM-dd',
			isShowOthers:false,
			minDate: '#F{$dp.$D(\'lastlogin_min\')}'
		});
	});
	
	$('#checkAll').checkAll('#result_form [name="uid[]"]');//全選
	$('a[method]').query(); //操作
	$('th[order_by]').order_by('<{$_url}>', <{$_order_by|@json_encode}>); //設定排序
});
})(jQuery);
</script>
	</body>
</html>
